<%@ page import="cn.school.service.GradeService" %>
<%@ page import="cn.school.entity.Grade" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: ghost
  Date: 2019/12/10
  Time: 16:00
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%@include file="checkLogin.jsp"%>
<form action="doAddStudent.jsp" method="post" enctype="multipart/form-data">
    <table cellpadding="10">
        <tr><td>姓名：</td><td><input type="text" name="sname" placeholder="姓名"></td></tr>
        <tr><td>性别：</td><td><input type="radio" name="sex" value="男">男<input type="radio" name="sex" value="女">女<input type="radio" name="sex" value="妖">妖</td></tr>
        <tr><td>电话号码：</td><td><input type="text" name="telephone"></td></tr>
        <tr><td>qq：</td><td><input type="text" name="qq"></td></tr>
        <tr><td>微信：</td><td><input type="text" name="wechat"></td></tr>
        <tr><td>年级：</td><td>
            <select name="gradeid">
                <%
                    GradeService gs = new GradeService();
                    List<Grade> list = gs.findAll();
                    for(Grade g:list){
                %>
                <option value="<%=g.getId()%>"><%=g.getGname()%></option>
                <% }%>
            </select>
        </td></tr>
        <tr><td>籍贯：</td><td><input type="text" name="fromcity"></td></tr>
        <tr><td>出生日期：</td><td><input id="birthday" type="date" name="birthday"></td></tr>
        <tr><td>现居地：</td><td><input type="text" name="address"></td></tr>
        <tr><td>登录密码：</td><td><input type="password" name="pass" required></td></tr>
        <tr><td>身份证照片：</td><td><input type="file" name="sfile" accept="jpg/png/gif" onchange="loadImgFile(event)"><img id="image" width="200px" height="100px" src=""></td></tr>
        <tr><td colspan="2"><input type="submit" value="上传"></td></tr>
    </table>
</form>
<script>
    function loadImgFile(event){
        var img = document.getElementById("image");
        img.src = URL.createObjectURL(event.target.files[0]);
    }
</script>
</body>
</html>
